package com.ujs.eduservice.controller.front;

import com.ujs.commonutils.constant.R;
import com.ujs.eduservice.service.EduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author zhangshihao
 * @create 2023-09-01 20:23
 */
@RestController
@RequestMapping("/eduservice/front/teacher")
@Api(tags = "前台讲师管理")
public class TeacherFrontController {
    @Autowired
    private EduTeacherService teacherService;

    @GetMapping("/getTeacherList/{page}/{limit}")
    @ApiOperation("分页查询讲师列表")
    public R getTeacherList(@PathVariable("page") Long page, @PathVariable("limit") Long limit) {
        Map<String, Object> map = teacherService.getTeacherList(page, limit);
        return R.ok().data(map);
    }

    @GetMapping("/getTeacherFrontInfo/{teacherId}")
    @ApiOperation("讲师详情，包括课程和基本信息")
    public R getTeacherFrontInfo(@PathVariable("teacherId") String teacherId) {
        Map<String, Object> map = teacherService.getTeacherInfo(teacherId);
        return R.ok().data(map);
    }
}
